package com.ruoyi.system.controller;

import java.util.List;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.system.domain.ZhuanjiabiandongshenbaoLizhi;
import com.ruoyi.system.service.IZhuanjiabiandongshenbaoLizhiService;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 专家变动申报_离职Controller
 * 
 * @author dy
 * @date 2024-05-27
 */
@Controller
@RequestMapping("/system/biandongshenbao_lizhi")
public class ZhuanjiabiandongshenbaoLizhiController extends BaseController
{
    private String prefix = "system/biandongshenbao_lizhi";

    @Autowired
    private IZhuanjiabiandongshenbaoLizhiService zhuanjiabiandongshenbaoLizhiService;

    @RequiresPermissions("system:biandongshenbao_lizhi:view")
    @GetMapping()
    public String biandongshenbao_lizhi()
    {
        return prefix + "/biandongshenbao_lizhi";
    }

    /**
     * 查询专家变动申报_离职列表
     */
    @RequiresPermissions("system:biandongshenbao_lizhi:list")
    @PostMapping("/list")
    @ResponseBody
    public TableDataInfo list(ZhuanjiabiandongshenbaoLizhi zhuanjiabiandongshenbaoLizhi)
    {
        startPage();
        List<ZhuanjiabiandongshenbaoLizhi> list = zhuanjiabiandongshenbaoLizhiService.selectZhuanjiabiandongshenbaoLizhiList(zhuanjiabiandongshenbaoLizhi);
        return getDataTable(list);
    }

    /**
     * 导出专家变动申报_离职列表
     */
    @RequiresPermissions("system:biandongshenbao_lizhi:export")
    @Log(title = "专家变动申报_离职", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    @ResponseBody
    public AjaxResult export(ZhuanjiabiandongshenbaoLizhi zhuanjiabiandongshenbaoLizhi)
    {
        List<ZhuanjiabiandongshenbaoLizhi> list = zhuanjiabiandongshenbaoLizhiService.selectZhuanjiabiandongshenbaoLizhiList(zhuanjiabiandongshenbaoLizhi);
        ExcelUtil<ZhuanjiabiandongshenbaoLizhi> util = new ExcelUtil<ZhuanjiabiandongshenbaoLizhi>(ZhuanjiabiandongshenbaoLizhi.class);
        return util.exportExcel(list, "专家变动申报_离职数据");
    }

    /**
     * 新增专家变动申报_离职
     */
    @GetMapping("/add")
    public String add()
    {
        return prefix + "/add";
    }

    /**
     * 新增保存专家变动申报_离职
     */
    @RequiresPermissions("system:biandongshenbao_lizhi:add")
    @Log(title = "专家变动申报_离职", businessType = BusinessType.INSERT)
    @PostMapping("/add")
    @ResponseBody
    public AjaxResult addSave(ZhuanjiabiandongshenbaoLizhi zhuanjiabiandongshenbaoLizhi)
    {
        return toAjax(zhuanjiabiandongshenbaoLizhiService.insertZhuanjiabiandongshenbaoLizhi(zhuanjiabiandongshenbaoLizhi));
    }

    /**
     * 修改专家变动申报_离职
     */
    @RequiresPermissions("system:biandongshenbao_lizhi:edit")
    @GetMapping("/edit/{shenbaoid}")
    public String edit(@PathVariable("shenbaoid") String shenbaoid, ModelMap mmap)
    {
        ZhuanjiabiandongshenbaoLizhi zhuanjiabiandongshenbaoLizhi = zhuanjiabiandongshenbaoLizhiService.selectZhuanjiabiandongshenbaoLizhiByShenbaoid(shenbaoid);
        mmap.put("zhuanjiabiandongshenbaoLizhi", zhuanjiabiandongshenbaoLizhi);
        return prefix + "/edit";
    }

    /**
     * 修改保存专家变动申报_离职
     */
    @RequiresPermissions("system:biandongshenbao_lizhi:edit")
    @Log(title = "专家变动申报_离职", businessType = BusinessType.UPDATE)
    @PostMapping("/edit")
    @ResponseBody
    public AjaxResult editSave(ZhuanjiabiandongshenbaoLizhi zhuanjiabiandongshenbaoLizhi)
    {
        return toAjax(zhuanjiabiandongshenbaoLizhiService.updateZhuanjiabiandongshenbaoLizhi(zhuanjiabiandongshenbaoLizhi));
    }

    /**
     * 删除专家变动申报_离职
     */
    @RequiresPermissions("system:biandongshenbao_lizhi:remove")
    @Log(title = "专家变动申报_离职", businessType = BusinessType.DELETE)
    @PostMapping( "/remove")
    @ResponseBody
    public AjaxResult remove(String ids)
    {
        return toAjax(zhuanjiabiandongshenbaoLizhiService.deleteZhuanjiabiandongshenbaoLizhiByShenbaoids(ids));
    }
}
